package operate;

import book.BookList;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-03-23
 * Time: 22:18
 */
public class SearchOperate implements Ioperate{
    @Override
    public void work(BookList bookList) {
        System.out.print("请输入要查找的书名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getBooknumber(); i++) {
            if (bookList.getBookList()[i].getName().equals(name)){
                System.out.println(bookList.getBookList()[i]);
                return;
            }
        }
        System.out.println("查无此书");
    }
}
